#pragma once

#include <windows.h>
#include <dx/d3d9.h>
#include <dx/DxErr.h>
#include <dx/d3dx9.h>

#include <vector>
#include <string>
#include <fstream>
#include <map>
#include <set>
#include <list>
#include <queue>
#include <time.h>
#include <tchar.h>
#include <deque>
#include <psapi.h>
#define _NO_CVCONST_H
#include <dbghelp.h>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <functional>

#ifndef _SCRIPT_LIB
#define DLL_EXPORT __declspec(dllexport)
#else
#define DLL_EXPORT __declspec(dllimport)
#endif

#define _CRT_SECURE_NO_WARNINGS
#pragma warning(disable: 4996)

typedef unsigned __int64 ui64;
typedef signed __int64 i64;
typedef unsigned int ui32;
typedef signed int i32;
typedef unsigned short ui16;
typedef signed short i16;
typedef unsigned char ui8;
typedef signed char i8;

#pragma warning(disable: 4251)
#pragma warning(disable: 4661)
#pragma warning(disable: 4244)

#include "Stormlib.h"

#include "./alglib/ap.h"
#include "./alglib/spline1d.h"

#include "ScopeHandle.h"
#include "Mutex.h"
#include "Utils.h"
#include "Geometry.h"
#include "resource.h"
#include "StartupHandler.h"
#include "ThreadUtils.h"

#define TILESIZE (533.33333f)
#define CHUNKSIZE ((TILESIZE) / 16.0f)
#define UNITSIZE (CHUNKSIZE / 8.0f)
#define ZEROPOINT (32.0f * (TILESIZE))
//#define MAPCHUNK_RADIUS	47.140452079103168293389624140323
#define MAPCHUNK_RADIUS	23.555494648276864406603127812618

#define MPQ_FILE_HANDLE  ((HANDLE)0x7FFFFFFF)

extern float fogDistance;

#include "ConfigFile.h"
#include "MpqHandler.h"
#include "CMpqFile.h"

#include "Thread.h"
#include "resource.h"
#include "ErrorScreen.h"
#include "Localisation.h"
#include "Mouse.h"
#include "FileBuffer.h"
#include "DBCStore.h"
#include "Camera.h"
#include "WMODefs.h"
#include "ADTDefs.h"
#include "IGraphicsTask.h"
#include "TaskManager.h"
#include "TerrainManager.h"
#include "D3DManager.h"
#include "Font.h"
#include "FontBatch.h"
#include "CWindow.h"
#include "SplashScreen.h"
#include "UIElement.h"
#include "UIButton.h"
#include "Tooltip.h"
#include "TooltipManager.h"
#include "IconButton.h"
#include "UILabel.h"
#include "DialogHandler.h"
#include "UIManager.h"
#include "MiniMap.h"
#include "VScrollBar.h"
#include "MainMenu.h"
#include "Mesh.h"
#include "TextureHandler.h"
#include "Texture.h"
#include "Shader.h"
#include "ShaderManager.h"
#include "ModelBase.h"
//#include "M2Cache.h"
//#include "M2Defs.h"
//#include "M2Model.h"
#include "WMOGroup.h"
#include "WMOModel.h"
//#include "ModelSelect.h"
#include "LiquidHandler.h"
#include "ADTTextureBlock.h"
#include "ADTLoader.h"
#include "ADTRender.h"
#include "ADTChunk.h"
#include "ADTModel.h"
#include "VertexCache.h"
#include "Loader.h"
#include "TutorialFrame.h"
#include "TutorialNotify.h"
#include "TutorialHandler.h"
#include "Panel.h"
#include "ToolBar.h"
#include "Chatbox.h"
#include "Checkbox.h"
#include "EditBox.h"
#include "Scrollbar.h"
#include "RadioButton.h"
#include "TreeView.h"
#include "Dialog.h"
#include "MessageBox.h"
#include "Hud.h"
#include "Input.h"
#include "Castbar.h"
#include "CommandHandler.h"
#include "UIProto.h"
#include "Agreement.h"
#include "SelectUI.h"
#include "LayerUI.h"
#include "ShaderUI.h"
#include "TerrainUI.h"
#include "TilesetUI.h"
#include "TexSelUI.h"
#include "BrowsingUI.h"
#include "CommandUI.h"
#include "Help.h"
#include "SettingDialog.h"
#include "SelectionMgr.h"
#include "TexturingUI.h"
#include "WdlCreator.h"
#include "AreaDialog.h"
#include "LoadingScreen.h"